package com.mjf.tankgame.v4;

import javax.swing.*;

public class TankGame04 extends JFrame {

    // 定义MyPanel
    MyPanel mp = null;

    public static void main(String[] args) {

        TankGame04 tankGame04 = new TankGame04();
    }

    public TankGame04() {
        mp = new MyPanel();

        // 将 mp 放入到Thread ,并启动不停重新绘制
        Thread thread = new Thread(mp);
        thread.start();

        this.add(mp);   // 把面板(就是游戏的绘图区域)
        this.setSize(1200, 950);
        this.addKeyListener(mp);    // 让 JFrame 监听mp的键盘事件
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }
}